//11. 盛最多水的容器
//https://leetcode.cn/problems/container-with-most-water/
class Solution {
private:
    int _maxArea = 0;
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;

        while (left < right) {
            int dif = right - left;
            int lower = height[left] > height[right] ? height[right--] : height[left++];
            _maxArea = max(_maxArea, dif * lower);
        }

        return _maxArea;
    }
};